<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h4 class="modal-title">付款凭证</h4>
</div>
<form id="files-form" action="/xqc/reimburse/paid-trace" method="post" enctype="multipart/form-data">
    <div class="modal-body">
        <div class="form-group">
            <label style="padding-top: 8px;" class="col-sm-3 control-label">付款凭证</label>
            <div class="col-sm-8">
                <input id="paid_file" type="file" style="margin-top: 4px;" name="source_file" accept=".jpg,.jpeg,.gif,.png,.bmp" required>
                <span class="help-block"><i class="fa fa-info-circle"></i>&nbsp;文件后缀为.jpg .jpeg .gif .png或.bmp</span>
            </div>
        </div>
    </div>
    <div class="modal-footer">
        {{ csrf_field() }}
        <input type="hidden" name="param" value="{{ $ids }}">
        <input type="hidden" name="action" value="batchPaid">
        <button type="submit" class="btn btn-primary" id="labels-submit">提交</button>
        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
    </div>
</form>
<script language="JavaScript" type="text/javascript">
    $(function () {
        $("#paid_file").fileinput({
            overwriteInitial: true,//不覆盖已存在的图片
            initialPreviewAsData: true,//仅发送预览数据而不是原始标记
            browseLabel: '浏览',
            showRemove: false,
            showUpload: false,
            showCancel: false,
        });
        $("#files-form").ajaxForm(function (data) {
            if (typeof data === 'object') {
                if (data.status) {
                    $("#uploadModal").modal('hide');
                    $(".modal-backdrop").remove();
                    $('body').removeClass('modal-open');
                    toastr.success('提交成功 !');
                    $.pjax.reload('#paid-form');
                } else {
                    swal(data.message, '', 'error');
                }
            }
        });
    });
</script>
